package com.ruoyi.ipms_patent.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.ipms_patent.service.ApplicantService;
import com.ruoyi.system.api.entity.Applicant;
import com.ruoyi.system.api.entity.Inventor;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: isBao
 * @Description:TODO:申请人controller
 */
@RestController
@RefreshScope
@RequestMapping("/patent/applicant")
public class ApplicantController extends BaseController {

    @Resource
    ApplicantService applicantService;

    /* 通过专利号查找申请人，传入0表示查找全部申请人*/
    @GetMapping("/find/{patentId}")
    public TableDataInfo findBypatentId(@PathVariable("patentId") int patentId){
        startPage();
        List<Applicant> caseList = applicantService.findApplicantBypatentId(patentId);
        return getDataTable(caseList);
    }

    /* 添加申请人*/
    @PostMapping("/add")
    public AjaxResult add(@RequestBody Applicant applicant){
        return toAjax(applicantService.insertApplicant(applicant));
    }
}
